package gamesrv.clientsim;

import java.util.ArrayList;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

	private static BundleContext context;
	
	private ArrayList<UserThread> threads; 
	
	
	static BundleContext getContext() {
		return context;
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext bundleContext) throws Exception {
		Activator.context = bundleContext;
		
		String[] names = {"Ania","Asia"};//,"Maciek","Jagoda","Krzysiek"}; 
		threads = new ArrayList<UserThread>();
		for (int i=0; i< names.length; i++)
		{
			UserThread tt = new UserThread(names[i],UserThread.TicTacToe);
			Thread t = new Thread(tt);
			t.start();
		}
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext bundleContext) throws Exception {
		Activator.context = null;
	}

}
